﻿<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    
</head>
<body>
    <form id="form1" runat="server">
    <div >
        <asp:Label ID="Label1" runat="server" Font-Bold="True" Text="RequiredFieldValidator控件应用示例"></asp:Label><br />
        <br />
        <asp:Label ID="Label2" runat="server" Text="学号"></asp:Label>
        &nbsp; &nbsp; &nbsp;<asp:TextBox ID="txtNum" runat="server"></asp:TextBox>&nbsp;
        <asp:RequiredFieldValidator ID="valrNum" runat="server" ControlToValidate="txtNum"
            ErrorMessage="请输入学号"></asp:RequiredFieldValidator><br />
        <br />
        <asp:Label ID="Label3" runat="server" Text="专业"></asp:Label>
        &nbsp; &nbsp; &nbsp;<asp:DropDownList ID="dropSpec" runat="server">
            <asp:ListItem>&quot;--请选择专业--&quot;</asp:ListItem>
        </asp:DropDownList>
        <asp:RequiredFieldValidator ID="valrSpeciality" runat="server" ControlToValidate="dropSpec"
            ErrorMessage="请选择一个专业" InitialValue='"请选择一个专业"'></asp:RequiredFieldValidator><br />
        <br />
        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
        <asp:Button ID="btnOK" runat="server" Text="提交" OnClick="btnOK_Click" />
        <br />
        <br />
        <asp:Label ID="lblResult" runat="server"></asp:Label></div>
    </form>
</body>
</html>